package cricket_behaviour

import (
	"longmen/server/internal/services/nami/services/sports/cricket"
	"longmen/server/pkg/db/mysql/models/models_sports"
)

type (
	CountryApiResponse struct {
		Code    int       `json:"code"`
		Results []Country `json:"results"`
	}

	Country struct {
		ID        int    `json:"id"`         // 国家id
		NameZh    string `json:"name_zh"`    // 中文名称
		NameZht   string `json:"name_zht"`   // 粤语名称
		NameEn    string `json:"name_en"`    // 英文名称
		Logo      string `json:"logo"`       // 国家logo
		UpdatedAt int    `json:"updated_at"` // 更新时间
	}
)

func (r CountryApiResponse) Interface() []cricket.InsertCountryInterface {
	a := make([]cricket.InsertCountryInterface, 0)
	for _, record := range r.Results {
		a = append(a, record)
	}
	return a
}

func (c Country) Get() models_sports.CricketCountry {
	return models_sports.CricketCountry{
		ID:        c.ID,
		NameZh:    c.NameZh,
		NameZht:   c.NameZht,
		NameEn:    c.NameEn,
		Logo:      c.Logo,
		UpdatedAt: c.UpdatedAt,
	}
}
